# -*- coding: utf-8 -*-
# __init__.py create by kumiler on 2025/6/30 10:55
# email:lukunming@jtexpress.com
# desc

import json
from src.tries.create_tbl.mysql2hive_v2 import main as mysql2hive
from src.tries.create_tbl.oracle2hive_v2  import main as oracle2hive

if __name__ == '__main__':

    # 示例JSON配置
    example_json = """
    {
        "ORACLE_SQL_DIR": "D:/projects/yl_procject/yl-bgdm-airflow/src/kumiler_platform/ddl_create_script/oracle_source_ddl",
        "HIVE_SQL_DIR": "D:/projects/yl_procject/yl-bgdm-airflow/src/kumiler_platform/hive_output",
        "TBLPROPERTIES": {
        "CREATOR": "john.doe",
        "SOURCE_SYSTEM": "CRM_SYSTEM",
        "TRANSLATED_FROM": "oracle",
        "SYNCH_RULE": "INCREMENTAL",
        "SYNCH_COL": "update_time",
        "FREQUENCY": "daily"
        },
    }
    """
    source_from = json.loads(example_json).get("TBLPROPERTIES").get("TRANSLATED_FROM")
    if source_from == "mysql":
        mysql2hive(example_json)
    else:
        oracle2hive(example_json)
